/*
 * @Author: hu_binbin
 * @Date: 2021-06-03 16:22:45
 * @LastEditTime: 2021-07-12 20:02:28
 * @Description: 缺陷api
 */
import request from '@/utils/request'
/**
 * @description: 获取缺陷记录 
 * @param {Object} data 请求参数
 */
export function getDefectList(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.post('/app/fsDefect/defectService/getDefectList', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 获取缺陷库 
 * @param {Object} data 请求参数
 */
export function getDefectDicInfo(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.post('/fsDefect/defectService/getDefectDicInfo', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 班组人员
 * @param {Object} data 请求参数
 */
export function getUserList(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.post('/user/getUserList', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 新增缺陷
 * @param {Object} data 请求参数
 */
export function addDefect(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.post('/fsDefect/defectService/addDefect', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 上传文件
 * @param {Object} data 请求参数
 */
export function uploadFile(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.uploadFileFile(data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 下载
 * @param {Object} data 请求参数
 */
export function downLoadFileUrl(data) {
	return new Promise((resolve, reject) => {
        //server-name/sys/sendPhoneSms
        request.downloadFileres('/fsDefect/defectService/downLoadAttachment', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * 审核
 * {Object} param请求参数
 *  return  Promise
 */
export function updateAuditStatus(param) {
	return new Promise((resolve, reject) => {
		request.post('/fsDefect/defectService/updateAuditStatus', param).then(result => {
			resolve(result)
		}, err => {
			reject(err)
		})
	})
}